require(['jquery', 'cookie', 'app', 'lay'], function ($) {
    require(['vue'], function (Vue) {
        var dic = new Vue({
            el: ".vue-box"
            , data: {
                where: [],
                that: {},
                mail: {}
            }
            , created: function () {
                this.seachs();
                this.mail = playAjax("/SwiperController/MailList").data
                layui.use(['form', 'laydate', 'upload'], function () {
                    var form = layui.form;
                    form.on('submit(formDemo)', function (data) {
                        debugger;
                        var jon = data.field;
                        jon['diction'] = {uuid: jon['diction']};
                        var re = playAjax("OrderController/mail", jon);
                        alr(re.msg);
                        return false;
                    });
                    form.on('submit(formDemoxx)', function (data) {
                        debugger;
                        var jon = data.field;
                        var re = playAjax("OrderController/anull", jon);
                        alr(re.msg);
                        return false;
                    });
                });
                layui.use(['form', 'laydate', 'upload'], function () {
                    var laydate = layui.laydate;
                    laydate.render({
                        elem: '#createTime', //指定元素

                    });
                    laydate.render({
                        elem: '#endTime', //指定元素

                    });
                });
            }
            , methods: {
                loadPage: function () {
                    var re = playAjax("bsp/59").data;
                    var toolbar = [];
                    if (fspuser["role"] == '1') {
                        toolbar[0] = {
                            "clas": "layui-btn-warm",
                            "eve": "PAY",
                            "tit": "付款",
                            "fnc": function (data) {
                                if (data.length == 0) {
                                    alr("请选中一行！");
                                    return false;
                                } else {
                                    var re = playAjax("OrderController/pay", {uuid: data[0].uuid});
                                    alr(re.msg);
                                }
                            }
                        }
                        toolbar[1] = {
                            "clas": "layui-btn-warm",
                            "eve": "MAIL",
                            "tit": "邮寄",
                            "fnc": function (data) {
                                if (data.length == 0) {
                                    alr("请选中一行！");
                                    return false;
                                } else {
                                    /*var re = playAjax("OrderController/mail", {uuid:data[0].uuid});
                                    alr(re.msg);*/
                                    $("#orderId").val(data[0].uuid);
                                    layer.open({
                                        type: 1,
                                        content: $('#admins')
                                        , area: ['400px', '450px']
                                        , cancel: function () {
                                            //右上角关闭回调
                                            $('#admins').hide();
                                            //return false 开启该代码可禁止点击该按钮关闭
                                        }
                                    });
                                }
                            }
                        }
                        toolbar[2] = {
                            "clas": "",
                            "eve": "ANULL",
                            "tit": "实付金额减免",
                            "fnc": function (data) {
                                if (data.length == 0) {
                                    alr("请选中一行！");
                                    return false;
                                } else {
                                    /*var re = playAjax("OrderController/mail", {uuid:data[0].uuid});
                                    alr(re.msg);*/
                                    $("#orderIdxx").val(data[0].uuid);
                                    layer.open({
                                        type: 1,
                                        content: $('#adminsxx')
                                        , area: ['400px', '450px']
                                        , cancel: function () {
                                            //右上角关闭回调
                                            $('#admins').hide();
                                            //return false 开启该代码可禁止点击该按钮关闭
                                        }
                                    });
                                }
                            }
                        }

                    }
                    bspVIEW($(".sa-table"), "/OrderController/List", re, this.where, toolbar);
                },
                seachs: function () {
                    this.where = whereJSON($(".el-form"));
                    this.loadPage();
                },
                referXadmin: function () {
                    window.location.reload();
                }
            }
        });
    })
});

function dt(uuid) {
    window.parent.sp.showTab({id: getCode(2), name: '订单详情', url: './vsp/71?uuid=' + uuid})
}